﻿<ribbon:RibbonWindow
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
        xmlns:local="clr-namespace:WebsiteLoadTool"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:WebsiteLoadTool_Controls="clr-namespace:WebsiteLoadTool.Controls" mc:Ignorable="d" x:Class="WebsiteLoadTool.MainView"
        Title="Website Load Tool"
		Width="640" Height="480" Icon="Images/WebsiteLoadToolIcon.ico" ResizeMode="CanResizeWithGrip">

    <ribbon:RibbonWindow.TaskbarItemInfo>
        <TaskbarItemInfo Description="Website Load Tool"/>
    </ribbon:RibbonWindow.TaskbarItemInfo>

    <ribbon:RibbonWindow.DataContext>
        <local:MainViewModel/>
    </ribbon:RibbonWindow.DataContext>

    <DockPanel>

        <ribbon:Ribbon x:Name="RibbonMenu" DockPanel.Dock="Top" ShowQuickAccessToolBarOnTop="False" IsMinimized="False" Focusable="False">
            <ribbon:Ribbon.ApplicationMenu>
                <ribbon:RibbonApplicationMenu SmallImageSource="Images\fileicon.png" Label="File" KeyTip="F">
                    <ribbon:RibbonApplicationMenu.FooterPaneContent>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <ribbon:RibbonApplicationMenuItem Header="Exit" ImageSource="Images/exit32.png" CanAddToQuickAccessToolBarDirectly="True" QuickAccessToolBarId="QAAfsluiten" QuickAccessToolBarImageSource="Images/exit16.png" KeyTip="X" Command="{Binding CloseCommand}" Grid.Column="1" />
                        </Grid>
                    </ribbon:RibbonApplicationMenu.FooterPaneContent>
                    <ribbon:RibbonApplicationMenuItem Header="_Settings" ImageSource="Images/system32.png" CanAddToQuickAccessToolBarDirectly="True" QuickAccessToolBarId="QAVersion" QuickAccessToolBarImageSource="Images/system16.png" Command="{Binding ShowConfigurationCommand}" />
                    <ribbon:RibbonSeparator />
                    <ribbon:RibbonApplicationMenuItem Header="_Log" ImageSource="Images/log32.png" CanAddToQuickAccessToolBarDirectly="True" QuickAccessToolBarId="QAVersion" QuickAccessToolBarImageSource="Images/log16.png" Command="{Binding ShowLogCommand}" />
                </ribbon:RibbonApplicationMenu>
            </ribbon:Ribbon.ApplicationMenu>
            <ribbon:RibbonTab Header="Home">
                <ribbon:RibbonGroup Header="Timer" LargeImageSource="Images/timer32.png" SmallImageSource="Images/timer16.png">
                    <ribbon:RibbonButton Label="Start" LargeImageSource="Images/stopwatch_start32.png" SmallImageSource="Images/stopwatch_start16.png" Command="{Binding StartTimerCommand}" />
                    <ribbon:RibbonButton Label="Stop" LargeImageSource="Images/stopwatch_stop32.png" SmallImageSource="Images/stopwatch_stop16.png" Command="{Binding StopTimerCommand}"/>
                </ribbon:RibbonGroup>
                <ribbon:RibbonGroup Header="Websites" Margin="0">
                    <ribbon:RibbonButton Label="Check Selected" LargeImageSource="Images/download32.png" SmallImageSource="Images/download16.png" Command="{Binding CheckSelectedWebsiteCommand}"/>
                </ribbon:RibbonGroup>
            </ribbon:RibbonTab>
        </ribbon:Ribbon>

        <StatusBar DockPanel.Dock="Bottom" Height="25" BorderBrush="WhiteSmoke">
            <StatusBar.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFE6EAEE" Offset="0"/>
                    <GradientStop Color="#FFB7BCC1" Offset="1"/>
                </LinearGradientBrush>
            </StatusBar.Background>
            <StatusBarItem Margin="2,0" HorizontalAlignment="Left">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Timer Active:" Margin="0,0,4,0" Foreground="#FF686868"/>
                    <TextBlock Text="{Binding TimerStarted}"/>
                </StackPanel>
            </StatusBarItem>
            <Separator Margin="2" HorizontalAlignment="Left"/>
            <StatusBarItem Margin="2,0" HorizontalAlignment="Left">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Timer Started:" Margin="0,0,4,0" Foreground="#FF686868"/>
                    <TextBlock Text="{Binding TimerStart, StringFormat='dd-MM-yyyy HH:mm:ss'}"/>
                </StackPanel>
            </StatusBarItem>
            <Separator Margin="2" HorizontalAlignment="Left"/>
            <StatusBarItem Margin="2,0" HorizontalAlignment="Left">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Timer Duration:" Margin="0,0,4,0" Foreground="#FF686868"/>
                    <TextBlock Text="{Binding TimerDurationString}"/>
                </StackPanel>
            </StatusBarItem>
            <Separator Margin="2" HorizontalAlignment="Left"/>
            <StatusBarItem Margin="2,0" HorizontalAlignment="Left">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Tests initiated in duration:" Margin="0,0,4,0" Foreground="#FF686868"/>
                    <TextBlock Text="{Binding TicksHandled}"/>
                </StackPanel>
            </StatusBarItem>
            <Separator Margin="2" HorizontalAlignment="Left"/>
        </StatusBar>

        <Border BorderBrush="#FF919191" BorderThickness="0,1" Background="#FFC2C6CA" Padding="2,0">
            <Grid Margin="0,2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.3*"/>
                    <RowDefinition Height="0.7*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="0.5*"/>
                </Grid.ColumnDefinitions>
                <DataGrid Margin="0,0,0,2" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding Websites}" SelectedItem="{Binding SelectedWebsite, Mode=TwoWay}">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="22">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <WebsiteLoadTool_Controls:StatusIndicator Width="12" Height="12" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,2,0,0" Status="{Binding LastResult.Status}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="0.2*"/>
                        <DataGridTextColumn Header="Status" Binding="{Binding LastResult.Status}" Width="0.1*"/>
                        <DataGridTextColumn Header="Start" Binding="{Binding LastResult.StartDateTime, StringFormat='dd-MM-yyyy HH:mm:ss'}" Width="0.1*"/>
                        <DataGridTextColumn Header="End" Binding="{Binding LastResult.EndDateTime, StringFormat='dd-MM-yyyy HH:mm:ss'}" Width="0.1*"/>
                        <DataGridTextColumn Header="Duration" Binding="{Binding LastResult.Duration, StringFormat=c}" Width="0.1*"/>
                    </DataGrid.Columns>
                </DataGrid>
                <DataGrid Grid.Row="1" AutoGenerateColumns="False" ItemsSource="{Binding SelectedWebsite.Results}" IsReadOnly="True">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="22">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <WebsiteLoadTool_Controls:StatusIndicator Width="12" Height="12" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,2,0,0" Status="{Binding Status}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn Header="Status" Binding="{Binding Status}" Width="0.1*"/>
                        <DataGridTextColumn Header="Start" Binding="{Binding StartDateTime, StringFormat='dd-MM-yyyy HH:mm:ss'}" Width="0.1*"/>
                        <DataGridTextColumn Header="End" Binding="{Binding EndDateTime, StringFormat='dd-MM-yyyy HH:mm:ss'}" Width="0.1*"/>
                        <DataGridTextColumn Header="Duration" Binding="{Binding Duration, StringFormat=c}" Width="0.1*"/>
                        <DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="0.3*"/>
                    </DataGrid.Columns>
                </DataGrid>
                <Border Grid.Column="1" Margin="2,0,0,0" Grid.RowSpan="2" BorderBrush="#FF688CAF" BorderThickness="1" Background="#FFFAFAFA" >
                	<ScrollViewer x:Name="LogScrollViewer">
                		<TextBlock x:Name="LogTextBlock" TextWrapping="Wrap" Text="{Binding LogText, Mode=OneWay}" FontSize="10.667" Margin="4" VerticalAlignment="Top" SizeChanged="LogTextBlock_SizeChanged" />
                	</ScrollViewer>
                </Border>
                <GridSplitter HorizontalAlignment="Stretch" Height="4" VerticalAlignment="Bottom" Background="#00F0F0F0" ShowsPreview="True" Margin="0,0,0,-1"/>
                <GridSplitter Background="#00F0F0F0" ShowsPreview="True" Width="2" HorizontalAlignment="Left" Grid.Column="1" Grid.RowSpan="2"/>
            </Grid>

        </Border>

    </DockPanel>
</ribbon:RibbonWindow>
